package com.mini.config;

import com.mini.filter.ParamsFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhangxiaobin
 * @title: FilterConfig
 * @description: 过滤器
 * @date 2020/2/2219:30
 */
@Configuration
public class FilterConfig {

    @Bean
    public FilterRegistrationBean filterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(new ParamsFilter());
        List<String> urlList = new ArrayList<String>();
        urlList.add("/student/exportAllStudents");
        registration.setUrlPatterns(urlList);
        registration.setName("ParamsFilter");
        registration.setOrder(1);
        return registration;
    }

}
